package oss.juelg.flashlight_mini;

public class FlashState {
	enum FlashMode { //TODO: support ON instead of TORCH
		OFF, TORCH, ON, TOGGLE //TOGGLE equals set(!current, ggf torch)
	}

	enum ReleasePolicy {
		EAGER, LAZY
	}

	public boolean mode;
	public ReleasePolicy policy;

	public FlashState(boolean mode, ReleasePolicy policy) {
		this.mode = mode;
		this.policy = policy;
	}
	
	public FlashState(FlashState old) {
		this.mode = old.mode;
		this.policy = old.policy;
	}

	//unused
	@Override
	public boolean equals(Object o) {
		if (o instanceof FlashState) {
			return this.hashCode() == o.hashCode();
		}

		return super.equals(o);
	}

	//unused
	@Override
	public int hashCode() {
//		return mode.ordinal() * FlashMode.values().length + policy.ordinal();
		return (mode ? 1 : 0) * ReleasePolicy.values().length + policy.ordinal();
	}
}
